(function(angular) {
	'use strict';
	angular.module("fs.waf").factory("countryService", countryService);
	countryService.$inject = [ '$q', 'loggerFactory' ,'ajaxServiceFactory'];
	function countryService($q, loggerFactory, ajaxServiceFactory) {
		var log = loggerFactory.getLogger("countryService");
		var ajaxService = ajaxServiceFactory.buildAjaxService({
			getCurrencyOptions : {
				url : 'do/cda/dataList/currencies',
				method : 'get'
			},
			getStates : {
				url : 'do/cda/dataList/statesTwo',
				method : 'post'
			}
		});
		
		function getStates(params,ctrl){
			ajaxService.getStates(params).then(function (response){
				angular.extend(ctrl.innerGridOptions, response);			
			});
		}
		
		function getCurrencyOptions() {
			var defer = $q.defer();
			ajaxService.getCurrencyOptions().then(function (response){
				defer.resolve(response);				
			});
			return defer.promise;
		}
		
		return {
			getCurrencyOptions : getCurrencyOptions,
			getStates : getStates
		};
	}
})(angular);